<template>
  <el-card>
    <div class="box">
      <img :src="userStore.avatar" class="avatar" />
      <div>
        <h1 class="title">{{ getTime() }}好！{{ userStore.username }}</h1>
        <span class="span">Real甄选后台管理平台</span>
      </div>
    </div>
  </el-card>
  <div class="bottom">
    <svg-icon
      class="svg"
      name="welcome"
      width="800px"
      height="400px"
    ></svg-icon>
  </div>
</template>

<script setup lang="ts">
// 引入onMounted生命周期
import { onMounted } from 'vue'
// 引入时间工具包
import { getTime } from '../../utils/time'
// 引入仓库,获取用户的头像，昵称
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
// 当home组件一挂载的时候，调用useUserStore中的方法去获取用户信息
onMounted(() => {
  userStore.userInfo()
})
</script>

<style lang="scss" scoped>
.box {
  display: flex;

  .avatar {
    height: 100px;
    width: 100px;
    border-radius: 50%;
  }

  div {
    margin-left: 15px;
  }

  .title {
    margin: 20px 0px;
    font-weight: 800;
  }

  .span {
    font-size: small;
    color: cadetblue;
    font-style: italic;
  }
}

.bottom {
  display: flex;
  justify-content: center;
  margin-top: 20px;

  .svg {
    width: 600px;
    height: 300px;
  }
}
</style>
